const { Service } = require("egg");

class CommentService extends Service {
    async addComment(content, bid, uid) {
        let sql = "insert into comment (content, bid, uid) values (?, ?, ?)";
        let params = [content, bid, uid];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }

    async readListByBid(bid) {
        let sql = "select * from comment where bid = ?";
        let params = [bid];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }
}

module.exports = CommentService;
